#include <Array.hpp>
#include <Json.hpp>
#include <System.h>
#include <boost/json.hpp>
#include <iostream>
#include <packet/Packet.h>
#include <packet/PacketStream.h>
#include <string>

using namespace sys;
using namespace boost;

int main(int argc, char const* argv[]) {
    json::value jv = {
        {"type", "Login"},
        {
            "account",
            {
                {"account", "hansi"},
                {"password", "hansi"},
            },
        }};
    try {
        packet::Packet pack;
        pack.setType(packet::Packet::Request);
        // pack.setBody("hello world");
        pack.setBody(json::serialize(jv));
        auto data = pack.encode();

        System::out << "pack:" << std::string(data.data(), data.size()) << std::endl;
    }
    catch (const std::exception& e) {
        std::cerr << e.what() << '\n';
    }

    return 0;
}
